let t = require;
let e = module;
let o = e.exports;
o.default = e.exports;

('use strict');
console.log('start');
var _n59,
  i =
    (this && this.__extends) ||
    ((_n59 = function n(t, e) {
      return (_n59 =
        Object.setPrototypeOf ||
        ({
          __proto__: []
        } instanceof Array &&
          function (t, e) {
            t.__proto__ = e;
          }) ||
        function (t, e) {
          for (var o in e) {
            Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
          }
        })(t, e);
    }),
    function (t, e) {
      function o() {
        this.constructor = t;
      }
      _n59(t, e),
        (t.prototype =
          null === e
            ? Object.create(e)
            : ((o.prototype = e.prototype), new o()));
    });
Object.defineProperty(o, '__esModule', {
  value: !0
}),
  (o.CardItemCom = void 0);
var r = t('UIComponent'),
  a = t('ComUtils'),
  s = t('BagMrg'),
  c = t('ResMrg'),
  l = t('SoundMrg'),
  u = t('AbsInfo'),
  h = t('UIMrg'),
  p = t('CardUpgradePanel'),
  f = (function (t) {
    function e(e, o) {
      var n = t.call(this, e) || this;
      return (
        (n._info = o),
        n._info.on(u.InfoEvent.LevelChanged, n.cardLevelChangedHandler, n),
        s.BagMrg.ins.addCountEvent(o.itemId, n.bagItemChangedHandler, n),
        n.refresh(),
        n
      );
    }
    return (
      i(e, t),
      (e.prototype.onInit = function () {
        t.prototype.onInit.call(this),
          (this._button = this.view.getComponent(cc.Button)),
          (this._imgCard = a.default.getComponent(
            cc.Sprite,
            this.view,
            'imgCard'
          )),
          (this._imgQuality = a.default.getComponent(
            cc.Sprite,
            this.view,
            'imgCard/imgQuality'
          )),
          (this._txtLevel = a.default.getComponent(
            cc.Label,
            this.view,
            'imgCard/level/txtLevel'
          )),
          (this._ndCount = a.default.getNode(this.view, 'imgCard/count')),
          (this._txtCount = a.default.getComponent(
            cc.Label,
            this.view,
            'imgCard/count/txtCount'
          )),
          (this._upgradeTips = a.default.getNode(
            this.view,
            'imgCard/upgradeTips'
          )),
          (this._txtManji = a.default.getNode(this.view, 'imgCard/txtManji')),
          (this._txtWeiHuoDe = a.default.getNode(
            this.view,
            'imgCard/txtWeiHuoDe'
          ));
      }),
      (e.prototype.onTouchEvenHandler = function (t) {
        t.type == cc.Node.EventType.TOUCH_END &&
          this._button.interactable &&
          (l.SoundMrg.click(), h.UIMrg.show(p.CardUpgradePanel, this._info));
      }),
      (e.prototype.bagItemChangedHandler = function () {
        this.refresh();
      }),
      (e.prototype.cardLevelChangedHandler = function () {
        this.refresh();
      }),
      (e.prototype.refresh = function () {
        var t = s.BagMrg.ins.getCount(this._info.itemId);
        c.ResMrg.loadSpriteByAtlas(
          this._imgCard,
          'Atlas/Card',
          this._info.icon
        ),
          c.ResMrg.loadSpriteByAtlas(
            this._imgQuality,
            'Atlas/Card',
            'quality' + this._info.quality
          ),
          (this._txtLevel.string = '' + this._info.level),
          (this._txtLevel.node.parent.active = this._info.own),
          (this._txtCount.string = t + '/' + this._info.itemCount),
          (this._txtCount.node.active = this._info.own),
          (this._txtWeiHuoDe.active = !this._info.own),
          this._info.own
            ? (this._info.isMaxLevel
                ? ((this._upgradeTips.active = !1),
                  (this._txtManji.active = !0),
                  (this._txtCount.node.active = !1))
                : (t < this._info.itemCount
                    ? (this._upgradeTips.active = !1)
                    : (this._upgradeTips.active = !0),
                  (this._txtManji.active = !1),
                  (this._txtCount.node.active = !0)),
              (this._button.interactable = !0))
            : ((this._upgradeTips.active = !1),
              (this._button.interactable = !1),
              (this._txtManji.active = !1)),
          a.default.setGray(this.view, !this._info.own);
      }),
      e
    );
  })(r.UIComponent);
(o.CardItemCom = f), console.log('end');
module.exports = e.exports;
